sfbtn = qtoolbar.menubutton(mnu, "skill levels||This button lets you control in which difficulty settings the entity should appear in the game. This lets you make a map harder by for example hiding some health boxes in the upper skill levels. You can also hide some entities in deatchmatch games, for example some doors, or a wall (this is the purpose of the func_wall entity).", ico_maped, 10)
sfbtn.caption = SFLetters[:len(sfskills)]
addspec = qtoolbar.button(self.plusminusclick, "insert an empty Specific/Arg pair", ico_maped, 11)
addspec.cmd = 0
deletespec = qtoolbar.button(self.plusminusclick, "delete a Specific/Arg pair", ico_maped, 12)
NegBtn = qtoolbar.button(self.neg1click, "negative poly||When a polyhedron is marked as negative, it behaves like a hole : every polyhedron in the same group as this one is 'digged' by the overlapping part.\n\nUsing 'Brush subtraction' in the 'Commands' menu is the same as marking the polyhedron negative, except that digging is not performed immediately. This helps keep the map clear.\n\nNegative polyhedrons appear in pink on the map.", ico_maped, 23)
ts2Btn = qtoolbar.button(self.resettexscale, "adjust texture to fit the face", ico_maped, 18)
ts2Btn.adjust = 1
ts3Btn = qtoolbar.button(self.resettexscale, "adjust texture on face but keep scaling to a minimum|adjust texture with minimum scaling", ico_maped, 24)
ts3Btn.adjust = 2
prevface = qtoolbar.button(self.nextface, "previous face of poly.", ico_dict['ico_mapedsm'], 0)
prevface.delta = -1
nextface = qtoolbar.button(self.nextface, "next face of poly.", ico_dict['ico_mapedsm'], 1)
nextface.delta = 1
#facezoombtn = qtoolbar.doublebutton(self.zoomface1click, getzoommenu, "choose zoom factor / zoom to 1:1 and back", ico_maped, 14)
"Builds additional pages for the multi-pages panel."
thesepages = []
page1 = qtoolbar.button(self.filldataform, "Specifics/Args-view||Specifics/Args-view:\n\nThis view displays the general parameters for the selected object(s).\n\nSee the infobase for a more detailed description and use of this view display.", ico_objects, iiEntity, "Specifics/Args-view", infobaselink='intro.mapeditor.dataforms.html#specsargsview')
page1.pc = [self.bs_dataform(panel)]
thesepages.append(page1)
page2 = qtoolbar.button(self.fillpolyform, "Polyhedron-view||Polyhedron-view:\n\nThis display shows the parameters about the selected polyhedron(s).\n\nSee the infobase for a more detailed description and use of this view display.", ico_objects, iiPolyhedron, "Polyhedron-view", infobaselink='intro.mapeditor.dataforms.html#polyhedronview')
page2.pc = [self.bs_polyform(panel)]
thesepages.append(page2)
page3 = qtoolbar.button(self.fillfaceform, "Face-view||Face-view:\n\nThis display shows the parameters about the selected face(s).\n\nSee the infobase for a more detailed description and use of this view display.", ico_objects, iiFace, "Face-view", infobaselink='intro.mapeditor.dataforms.html#faceview')
page3.pc = [self.bs_faceform(panel)]
page3.needangle = 1
thesepages.append(page3)
# only show the bezier-page, if the game supports bezierpatches
"Drop your most commonly used prefabs and entities to this panel||This panel is a good place to put 'prefabs', that is, nice entities, polyhedrons, or whole groups.\n\nYou add prefabs to the panel by dragging them from the tree view; they become buttons on which you can click to re-insert them in your maps.\n\nApart from the first line of buttons, you can reorder them by dragging them around with the mouse, and remove them by dragging them to the 'trash' button below.|intro.mapeditor.userdata.html",
"Automatically switch the multi-pages-panel for the current selection."
if (self.mpp.n<4) and not (self.mpp.lock.state & qtoolbar.selected):
fs = self.explorer.focussel
if fs is None:
self.mpp.viewpage(0)
elif fs.type == ':e':
self.mpp.viewpage(1)
elif fs.type == ':p':
self.mpp.viewpage(2)
elif fs.type == ':f':
self.mpp.viewpage(3)
def filldataform(self, reserved):
import mapentities
sl = self.explorer.sellist
formobj = mapentities.LoadEntityForm(sl)
self.dataform.setdata(sl, formobj)
help = ((formobj is not None) and formobj["Help"]) or ""
if help:
help = "?" + help # this trick displays a blue hint
self.buttons["help"].hint = help + "||This button gives you the description of the selected entity, and how to use it.\n\nYou are given help in two manners : by simply moving the mouse over the button, a 'hint' text appears with the description; if you click the button, you are sent to an HTML document about the entity, if available, or you are shown the same text as previously, if nothing more is available.\n\nNote that there is currently not a lot of info available as HTML documents."
sfbtn = self.buttons["sf"]
if sl:
icon = mapentities.EntityIconSel(sl[0])
for s in sl[1:]:
icon2 = mapentities.EntityIconSel(s)
if not (icon is icon2):
icon = ico_objects[1][iiEntity]
break
sfbtn.state = 0
cap = ""
for i in range(0, len(sfbtn.menu)):
m = sfbtn.menu[i]
if self.dataform.bitspec("spawnflags", m.skill):
m.state = 0
else:
m.state = qmenu.checked
cap = cap + SFLetters[i]
if not cap:
cap = "----"
else:
sfbtn.state = qtoolbar.disabled
cap = SFLetters[:len(sfbtn.menu)]
icon = ico_objects[1][iiEntity]
sfbtn.caption = cap
btnlist = self.mpp.btnpanel.buttons
if not (btnlist[1].icons[3] is icon):
l = list(btnlist[1].icons)
l[3] = icon
l[4] = icon
btnlist[1].icons = tuple(l)
self.mpp.btnpanel.buttons = btnlist
quarkx.update(self.editor.form)
def getpolylists(self):
slist = self.explorer.sellist
for s in slist[:]:
if s.type == ':f':
slist.remove(s)
slist = slist + s.faceof
plist = []
for s in slist:
for p in s.findallsubitems("", ':p'): # find all polyhedrons
if not (p in plist):
plist.append(p)
return plist
def fillpolyform(self, reserved):
self.polyview.invalidate(1)
plist = self.getpolylists()
NegBtn = self.buttons["negpoly"]
if len(plist)==0:
ns = qtoolbar.disabled
else:
for p in plist:
if p["neg"]:
ns = qtoolbar.selected
break
else:
ns = 0
NegBtn.state = ns
quarkx.update(self.editor.form)
q = quarkx.newobj(':') # internal object
if len(plist)==0:
cap = Strings[145]
elif len(plist)==1:
cap = plist[0].error
if cap:
cap = cap.capitalize()
else:
cap = Strings[142]
else:
cap = Strings[143] % len(plist)
q["header"] = cap
cntf, cnti = 0, 0
for p in plist:
cnti = cnti + p.rebuildall()[1]
cntf = cntf + len(p.faces)
if cnti:
cap = Strings[141] % (cntf, cnti)
else:
cap = Strings[140] % cntf
q["faces"] = cap
if len(plist)==1:
cap = plist[0].origin
if cap is not None:
q["center"] = cap.tuple
texlist = quarkx.texturesof(plist)
texhint = "TEX?"
for tex in texlist:
texhint = texhint + tex + ";"
if len(texlist)<=1:
if len(texlist):
cap = texlist[0]
else:
cap = ""
texlist = quarkx.texturesof([self.editor.Root]) # all textures in the map
else:
cap = Strings[179] % len(texlist)
q["texture"] = cap
q["oldtex"] = cap
q["texture$Items"] = quarkx.list2lines(texlist)
q["texture$Hint"] = texhint
if len(plist):
test = plist[0].parent
cap = test.shortname
for p in plist:
test2 = p.parent
if not (test2 is test):
cap = Strings[144]
break
q["ownedby"] = cap
self.polyform.setdata(q, self.polyform.form)
def polyformchange(self, src):
plist = self.getpolylists()
undo = quarkx.action()
q = src.linkedobjects[0]
ncenter = q["center"]
if ncenter is not None:
ncenter = quarkx.vect(ncenter) # tuple->vect
for p in plist:
org = p.origin
if (org is not None) and (ncenter-org):
new = p.copy()
new.translate(ncenter-org)
plist[plist.index(p)] = new
undo.exchange(p, new)
ntex = q["texture"]
applycount = 0
if (ntex is not None) and (ntex!="") and (ntex!=q["oldtex"]):